AS = pic30-as.exe
CC = pic30-gcc.exe
LD = pic30-ld.exe
AR = pic30-ar.exe
HX = pic30-bin2hex.exe
RM = del

BIN = bin
OBJ = obj
SRC = ..\..\src

OBJS = $(OBJ)\main.o \
	$(OBJ)\LEDBlink.o \

all : $(BIN)\PIC24F.hex

$(BIN)\PIC24F.hex : $(OBJ)\PIC24F.cof
	if not exist $(BIN) md $(BIN)
	$(HX) $(OBJ)\PIC24F.cof
	move $(OBJ)\PIC24F.hex $(BIN)\PIC24F.hex

$(OBJ)\PIC24F.cof : $(OBJS)
	$(CC) -mcpu=24F16KA102 $(OBJS) -o $(OBJ)\PIC24F.cof -Wl,-Tp24F16KA102.gld,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,-Map=$(OBJ)\PIC24F.map,--report-mem

{$(SRC)}.c{$(OBJ)}.o:
	if not exist $(OBJ) md $(OBJ)
	$(CC) -mcpu=24F16KA102 -x c -c $< -o $@ -D__DEBUG -g -Wall

clean : 
	$(RM) $(OBJ)\* $(BIN)\* /q

